package egean.pad.tool;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;



/**
 * 使用SharedPreferences保存用户资料信息
 * @author tr
 * @date   2012-6-12
 */
public class SharedPre {
	
	
	
	
	public static  String shared_name="shared";
	public static  String user_pn="user_pn";
	public static  String user_name="user_name";
	public static  String user_account="user_account";
	public static  String user_cust_no="user_cust_no";
	public static  String user_cust_pwd="user_cust_pwd";
	public static  String user_mobile="user_mobile";
	public static  String id_number="id_number";
	public static  String id_chip="id_chip";
	public static  String user_email="user_email";
	public static  String user_birthday="user_birthday";
	public static  String user_height="user_height";
	public static  String user_waistline="user_waistline";
	public static  String user_weight="user_weight";
	public static  String user_sex="user_sex";
	public static  String user_chip_id="user_chip_id";
	public static  String user_address="user_address";
	public static  String user_ethnic="user_ethnic";
	public static  String user_id_card="user_id_card";
	public static  String user_bp_level="user_bp_level";

	/**主备服务器切换，0表示主服务器，1表示备用服务器*/
	public static String user_service_address = "user_service_address";

	/**
	 * 存储数据
	 * @param context 调用对象
	 * @param m_key 关键字
	 * @param m_value 数据
	 */
     public  static  void Sharedsave(Context context,String m_key, String m_value  ){
    	 SharedPreferences preferences=context.getSharedPreferences(shared_name, 0);
    	 Editor editor=preferences.edit();
    	 editor.putString(m_key, m_value);
    	 editor.commit();
     }
     /**
      * 获取存储的数据
      * @param context 调用对象
      * @param m_name 关键字
      * @return
      */
     public static String SharedExtract(Context context,String m_name){
    	 
    	 SharedPreferences preferences=context.getSharedPreferences(shared_name, 0);
    	 String m_key=preferences.getString(m_name, null);
    	 return m_key;
    	 
     }
     /**
      * 清空所有登录信息
      * @param context
      */
     public static void SharedClear(Context context){
    	 SharedPreferences preferences=context.getSharedPreferences(shared_name, 0);
    	 Editor editor=preferences.edit();
    	 editor.clear();
    	 editor.commit();
     }
}
